package com.diandian.backend.dingding.data.controller;

import com.diandian.backend.dingding.data.param.*;
import com.diandian.backend.dingding.data.service.DingdingStaffSalaryOpenApiService;
import com.diandian.base.boot.starter.response.BaseResult;
import com.diandian.base.boot.starter.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * [钉钉]员工薪资表
 */
@RestController
@RequestMapping("/staff/salary/open/api")
public class DingdingStaffSalaryOpenApiController {

    @Autowired
    private DingdingStaffSalaryOpenApiService dingdingStaffSalaryOpenApiService;

    /**
    * 分页查询员工工资
    * 说明：上级查看下级所有人员的工资
    */
    @PostMapping("/page")
    public BaseResult page(@RequestBody DingdingStaffSalaryPageOpenApiParam param) {
        param.check();
        param.hiredDateHandler();
        return ResultUtil.makeResult(dingdingStaffSalaryOpenApiService.page(param));
    }

    /**
     * 分页查询指定员工工资
     * 说明：上级查看下级所有人员的工资
     */
    @PostMapping("/page/staff")
    public BaseResult pageStaff(@RequestBody DingdingStaffSalaryStaffPageOpenApiParam param) {
        param.check();
        return ResultUtil.makeResult(dingdingStaffSalaryOpenApiService.pageStaff(param));
    }

}